package com.qfedu.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.github.pagehelper.PageInfo;
import com.qfedu.entity.GoodsEntity;
import com.qfedu.service.GoodsService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class goodsController {

    @Reference(check = false)
    GoodsService goodsService;

    //分页查询商品
    @RequestMapping("jumpgoodslist")
    public String querygoods(GoodsEntity ge, HttpServletRequest request){
        PageInfo<GoodsEntity> queryfenye = goodsService.queryfenye(ge);
        request.setAttribute("pageInfo",queryfenye);
        request.setAttribute("gee",ge);

        return "goodslist";
    }

    //状态调整
    @RequestMapping("pass.do")
    @ResponseBody
    public String dopass(int gid,int bz){
        boolean updzt = goodsService.updzt(gid, bz);
        if (updzt){
            return "0000";
        }
        return "0001";
    }


}
